package com.indianindie;

import javax.microedition.khronos.opengles.GL10;

import android.util.Log;

public class SRGameBackGround extends SRGameDisplayObject {

	private  float scrollPosition;
	private float scrollSpeed;
	
	public SRGameBackGround(int texture_id, int texture_resource,float _scrollSpeed) {
		super(0.0f, 0.0f, (float) SRGameDisplayObject.DISPLAY_BLOCK_WIDTH, (float) SRGameDisplayObject.DISPLAY_BLOCK_HEIGHT,
				texture_id, texture_resource, false);
		this.scrollSpeed = _scrollSpeed;
		// TODO Auto-generated constructor stub
	}

	@Override
	public boolean inView(SRGameDisplayObject gameObject) {
		return true;
	}
	
	@Override
	public void setUpOpenGL(GL10 gl) {
		super.setUpOpenGL(gl);
		if (scrollPosition == Float.MAX_VALUE){
			scrollPosition = 0f;
		}
		
		Log.i("background",scrollPosition+"");
		
		gl.glMatrixMode(GL10.GL_TEXTURE);
		gl.glLoadIdentity();
	    gl.glTranslatef(0.0f,scrollPosition, 0.0f); 
	   
	    scrollPosition +=  this.scrollSpeed;

		
	}
}
